package com.yanqu.road.entity.activity.suoyao;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.DataStatus;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@FieldTypeAnnotation(tableName = "t_u_activity_suoyao_user_data")
public class SuoYaoUserData extends DataObject {

    @FieldTypeAnnotation(desc = "活动ID", select = true, update = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "用户ID", select = true, update = true)
    private long userId;
    @FieldTypeAnnotation(desc = "当前楼层")
    private int floorNo;
    // 锁妖塔领取过的奖励列表
    @FieldTypeAnnotation(desc = "领取过的盘面上的奖励列表")
    private List<Integer> rewardIdList = new ArrayList<>();
    @FieldTypeAnnotation(desc = "积分")
    private int score;
    @FieldTypeAnnotation(desc = "剑灵值")
    private int swordValue;
    @FieldTypeAnnotation(desc = "盲盒开启数据：盲盒下标，奖励ID")
    private Map<Integer, Integer> drawBoxMap = new ConcurrentHashMap<>();

    @FieldTypeAnnotation(desc = "总抽盲盒次数")
    private int totalTimes;
    @FieldTypeAnnotation(desc = "盲盒普通奖励次数")
    private int commonTimes;
    @FieldTypeAnnotation(desc = "低价隐藏款抽到次数")
    private int lowHideTimes;
    @FieldTypeAnnotation(desc = "通关轮次")
    private int round;

    @FieldTypeAnnotation(desc = "获得过的顶层奖励的数据")
    private Map<Integer,SuoYaoHasGetRewardData> hasGetRewardData = new ConcurrentHashMap<>();
    @FieldTypeAnnotation(desc = "当前选择的顶层奖励数据")
    private SuoYaoChooseRewardData chooseRewardData;
    @FieldTypeAnnotation(desc = "已获取的图鉴奖励")
    private List<Integer> hasGetBookRewardList;

    @FieldTypeAnnotation(desc = "获得过的顶层自选奖励的数据")
    private Map<Integer, SuoYaoHasGetRewardData> hasGetSelectedData = new ConcurrentHashMap<>();

    // 上次抽低价隐藏盲盒时间
    private long lastDrawHideTime;

    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }
    }

    public void setFloorNo(int floorNo) {
        if (this.floorNo != floorNo) {
            this.floorNo = floorNo;
            setOp(DataStatus.Update);
        }
    }

    public void setScore(int score) {
        if (this.score != score) {
            this.score = score;
            setOp(DataStatus.Update);
        }
    }

    public void setSwordValue(int swordValue) {
        if (this.swordValue != swordValue) {
            this.swordValue = swordValue;
            setOp(DataStatus.Update);
        }
    }

    public void setTotalTimes(int totalTimes) {
        if (this.totalTimes != totalTimes) {
            this.totalTimes = totalTimes;
            setOp(DataStatus.Update);
        }
    }

    public void setCommonTimes(int commonTimes) {
        if (this.commonTimes != commonTimes) {
            this.commonTimes = commonTimes;
            setOp(DataStatus.Update);
        }
    }

    public void setLowHideTimes(int lowHideTimes) {
        if (this.lowHideTimes != lowHideTimes) {
            this.lowHideTimes = lowHideTimes;
            setOp(DataStatus.Update);
        }
    }

    public void setRewardIdList(List<Integer> rewardIdList) {
        this.rewardIdList = rewardIdList;
        setUpdateOption();
    }

    public void setDrawBoxMap(Map<Integer, Integer> drawBoxMap) {
        this.drawBoxMap = drawBoxMap;
        setUpdateOption();
    }

    public void setLastDrawHideTime(long lastDrawHideTime) {
        this.lastDrawHideTime = lastDrawHideTime;
    }

    public int getActivityId() {
        return activityId;
    }

    public long getUserId() {
        return userId;
    }

    public int getFloorNo() {
        return floorNo;
    }

    public List<Integer> getRewardIdList() {
        return rewardIdList;
    }

    public int getScore() {
        return score;
    }

    public int getSwordValue() {
        return swordValue;
    }

    public Map<Integer, Integer> getDrawBoxMap() {
        return drawBoxMap;
    }

    public int getTotalTimes() {
        return totalTimes;
    }

    public int getCommonTimes() {
        return commonTimes;
    }

    public int getLowHideTimes() {
        return lowHideTimes;
    }

    public long getLastDrawHideTime() {
        return lastDrawHideTime;
    }

    public Map<Integer, SuoYaoHasGetRewardData> getHasGetRewardData() {
        return hasGetRewardData;
    }

    public void setHasGetRewardData(java.util.Map<java.lang.Integer, com.yanqu.road.entity.activity.suoyao.SuoYaoHasGetRewardData> hasGetRewardData) {
        if (null == hasGetRewardData){
            return;
        }
        if (this.hasGetRewardData == null || !this.hasGetRewardData.equals(hasGetRewardData)) {
            this.hasGetRewardData = hasGetRewardData;
            setOp(DataStatus.Update);
        }
    }

    public SuoYaoChooseRewardData getChooseRewardData() {
        return chooseRewardData;
    }

    public void setChooseRewardData(SuoYaoChooseRewardData chooseRewardData) {
        if (null == chooseRewardData){
            return;
        }
        if (this.chooseRewardData == null || !this.chooseRewardData.equals(chooseRewardData)) {
            this.chooseRewardData = chooseRewardData;
            setOp(DataStatus.Update);
        }
    }

    public int getRound() {
        return round;
    }

    public void setRound(int round) {
        if (this.round!=round){
            this.round = round;
            setUpdateOption();
        }
    }

    public void addRound(){
        setRound(getRound()+1);
    }

    public List<Integer> getHasGetBookRewardList() {
        return hasGetBookRewardList;
    }

    public void setHasGetBookRewardList(java.util.List<java.lang.Integer> hasGetBookRewardList) {
        if (null == hasGetBookRewardList){
            return;
        }
        if (this.hasGetBookRewardList == null || !this.hasGetBookRewardList.equals(hasGetBookRewardList)) {
            this.hasGetBookRewardList = hasGetBookRewardList;
            setOp(DataStatus.Update);
        }
    }

    public Map<Integer, SuoYaoHasGetRewardData> getHasGetSelectedData() {
        return hasGetSelectedData;
    }

    public void setHasGetSelectedData(java.util.Map<java.lang.Integer, com.yanqu.road.entity.activity.suoyao.SuoYaoHasGetRewardData> hasGetSelectedData) {
        if (null == hasGetSelectedData){
            return;
        }
        if (this.hasGetSelectedData == null || !this.hasGetSelectedData.equals(hasGetSelectedData)) {
            this.hasGetSelectedData = hasGetSelectedData;
            setOp(DataStatus.Update);
        }
    }
}
